package com.yx.fsysserver.file.controller;

import com.yx.fsysserver.common.result.JsonResult;
import com.yx.fsysserver.file.service.TencentPlayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 腾讯云视频点播加密
 * @author cuihao
 * @date  2017/3/3.
 */
@RestController
@RequestMapping("/tencentPlay")
public class TencentPlayController {
    private Logger log = LoggerFactory.getLogger(TencentPlayController.class);

    @Autowired
    private TencentPlayService tencentPlayService;

    /**
     * 上传前,从腾讯云点播获取上传signature
     * @return
     */
    @RequestMapping(value = "/getSignature", method = RequestMethod.GET)
    public JsonResult getUploadInfo() {
        String signature = tencentPlayService.getSignature();
        if("".equals(signature)){
            return new JsonResult(false,"获取腾讯云点播签名失败!");
        }else{
            return new JsonResult(true,"获取腾讯云点播签名成功!",signature);
        }
    }

}
